package com.cx.service.fhy.impl;

import com.cx.mapper.GameMapper;
import com.cx.pojo.Game;
import com.cx.pojo.GameExample;
import com.cx.service.fhy.GameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GameServiceImpl implements GameService {
    @Autowired
    GameMapper gameMapper;

    @Override
    public int publishgame(Game game) {
       return gameMapper.publishGame(game);
    }

    @Override
    public int updategame(Game game,Integer gameId) {
        GameExample gameExample = new GameExample();
        GameExample.Criteria criteria = gameExample.createCriteria();
        criteria.andGameIdEqualTo(gameId);
        return gameMapper.updateByExampleSelective(game,gameExample);
    }

    @Override
    public int deletegame(Integer gameId) {
        return gameMapper.deleteGame(gameId);
    }

    @Override
    public List<Game> selectByUserId(String userId) {
        return gameMapper.selectByUserId(userId);
    }

    @Override
    public Game selectByGameId(Integer id) {
        return gameMapper.selectByPrimaryKey(id);
    }
}
